﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Stamp_For_Africa_Version_2.Models;

namespace Stamp_For_Africa_Version_2.Repositories
{
  public class WatermarkRepository
  {

		private StampsDataContext db = new StampsDataContext();
		//
		// Query Methods


		public IQueryable<Watermark> FindAllWatermarks()
		{
			return db.Watermarks;
		}

		public Watermark GetWatermark(Guid id)
		{
		  return db.Watermarks.Where(u => u.Id == id).SingleOrDefault();
		}
		
		//
		// Insert/Delete Methods

		public void Add(Watermark watermark)
		{
			db.Watermarks.InsertOnSubmit(watermark);
		  Save();
		}

		public void Delete(Watermark watermark)
		{
			db.Watermarks.DeleteOnSubmit(watermark);
      Save();
		}

 


		//
		// Persistence

		public void Save()
		{
			db.SubmitChanges();
		}
	}

}